package event;

import org.springframework.context.ApplicationEvent;

/**
 * 测试Spring的事件机制，容器事件需要继承ApplicationEvent基类
 */
public class EmailEvent extends ApplicationEvent{
    private String address;
    private String text;

    public EmailEvent(Object source) {
        super(source);
    }

    public EmailEvent(Object source, String address, String text) {
        super(source);
        this.address = address;
        this.text = text;
    }

    @Override
    public String toString() {
        return "<EmailEvent: "+getAddress()+", "+getText()+", "+getSource()+">";
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getAddress() {
        return address;
    }

    public void setText(String text) {
        this.text = text;
    }

    public String getText() {
        return text;
    }
}
